﻿'*******************************************************************************************
'* Copyright Brügmann Software GmbH, Papenburg
'* Author: Björn Kremer
'* Contact: codeplex<at>patorg.de
'* 
'* VB.CMIS is a VB.NET implementation of the Content Management Interoperability Services (CMIS) standard
'*
'* This file is part of VB.CMIS.
'* 
'* VB.CMIS is free software: you can redistribute it and/or modify
'* it under the terms of the GNU Lesser General Public License as published by
'* the Free Software Foundation, either version 3 of the License, or
'* (at your option) any later version.
'* 
'* VB.CMIS is distributed in the hope that it will be useful,
'* but WITHOUT ANY WARRANTY; without even the implied warranty of
'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'* GNU Lesser General Public License for more details.
'* 
'* You should have received a copy of the GNU Lesser General Public License
'* along with VB.CMIS. If not, see <http://www.gnu.org/licenses/>.
'*******************************************************************************************
Imports System.Runtime.Serialization
Imports System.Xml.Serialization

Namespace ServiceDocument

   <XmlRoot("mapping", [Namespace]:=CmisNamespaceConstants.Cmis)> _
   Public Class PermissionMapping
      Implements IXmlSerializable

      Public Property Key() As AllowableActionsKey

      Public Property permission() As String()

      Public Enum AllowableActionsKey
         <EnumMember(Value:="canGetDescendents.Folder")> _
         CanGetDescendentsFolder

         <EnumMember(Value:="canGetChildren.Folder")> _
         CanGetChildrenFolder

         <EnumMember(Value:="canGetParents.Folder")> _
         CanGetParentsFolder

         <EnumMember(Value:="canGetFolderParent.Object")> _
         CanGetFolderParentObject

         <EnumMember(Value:="canCreateDocument.Type")> _
         CanCreateDocumentType

         <EnumMember(Value:="canCreateDocument.Folder")> _
         CanCreateDocumentFolder

         <EnumMember(Value:="canCreateFolder.Type")> _
         CanCreateFolderType

         <EnumMember(Value:="canCreateFolder.Folder")> _
         CanCreateFolderFolder

         <EnumMember(Value:="canCreateRelationship.Type")> _
         CanCreateRelationshipType

         <EnumMember(Value:="canCreateRelationship.Source")> _
         CanCreateRelationshipSource

         <EnumMember(Value:="canCreateRelationship.Target")> _
         CanCreateRelationshipTarget

         <EnumMember(Value:="canCreatePolicy.Type")> _
         CanCreatePolicyType

         <EnumMember(Value:="canGetProperties.Object")> _
         CanGetPropertiesObject

         <EnumMember(Value:="canViewContent.Object")> _
         CanViewContentObject

         <EnumMember(Value:="canUpdateProperties.Object")> _
         CanUpdatePropertiesObject

         <EnumMember(Value:="canMove.Object")> _
         CanMoveObject

         <EnumMember(Value:="canMove.Target")> _
         CanMoveTarget

         <EnumMember(Value:="canMove.Source")> _
         CanMoveSource

         <EnumMember(Value:="canDelete.Object")> _
         CanDeleteObject

         <EnumMember(Value:="canDeleteTree.Folder")> _
         CanDeleteTreeFolder

         <EnumMember(Value:="canSetContent.Document")> _
         CanSetContentDocument

         <EnumMember(Value:="canDeleteContent.Document")> _
         CanDeleteContentDocument

         <EnumMember(Value:="canAddToFolder.Object")> _
         CanAddToFolderObject

         <EnumMember(Value:="canAddToFolder.Folder")> _
         CanAddToFolderFolder

         <EnumMember(Value:="canRemoveFromFolder.Object")> _
         CanRemoveFromFolderObject

         <EnumMember(Value:="canRemoveFromFolder.Folder")> _
         CanRemoveFromFolderFolder

         <EnumMember(Value:="canCheckout.Document")> _
         CanCheckoutDocument

         <EnumMember(Value:="canCancelCheckout.Document")> _
         CanCancelCheckoutDocument

         <EnumMember(Value:="canCheckin.Document")> _
         CanCheckinDocument

         <EnumMember(Value:="canGetAllVersions.VersionSeries")> _
         CanGetAllVersionsVersionSeries

         <EnumMember(Value:="canGetObjectRelationships.Object")> _
         CanGetObjectRelationshipsObject

         <EnumMember(Value:="canAddPolicy.Object")> _
         CanAddPolicyObject

         <EnumMember(Value:="canAddPolicy.Policy")> _
         CanAddPolicyPolicy

         <EnumMember(Value:="canRemovePolicy.Object")> _
         CanRemovePolicyObject

         <EnumMember(Value:="canRemovePolicy.Policy")> _
         CanRemovePolicyPolicy

         <EnumMember(Value:="canGetAppliedPolicies.Object")> _
         CanGetAppliedPoliciesObject

         <EnumMember(Value:="canGetACL.Object")> _
         CanGetACLObject

         <EnumMember(Value:="canApplyACL.Object")> _
         CanApplyACLObject
      End Enum

      Public Function GetSchema() As System.Xml.Schema.XmlSchema Implements System.Xml.Serialization.IXmlSerializable.GetSchema
         Return Nothing
      End Function

      Public Sub ReadXml(reader As System.Xml.XmlReader) Implements System.Xml.Serialization.IXmlSerializable.ReadXml

      End Sub

      Public Sub WriteXml(writer As System.Xml.XmlWriter) Implements System.Xml.Serialization.IXmlSerializable.WriteXml
         writer.WriteElementString("key", CmisNamespaceConstants.Cmis, Common.GetDataMemberValueFromEnum(Me.Key, GetType(AllowableActionsKey)))
         For Each p As String In permission
            writer.WriteElementString("permission", CmisNamespaceConstants.Cmis, p)
         Next



      End Sub
   End Class
End Namespace